﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace RTracker.Models.Organization
{
    /// <summary>
    /// Model for an Organization, used to get and set values of Organization properties.
    /// </summary>
    public class COrganization
    {
        int m_nOrganizationId;
        String m_strOrganizationName;
        String m_strAddress;
        String m_strCity;
        String m_strState;
        String m_strZip;
        String m_strWebSite;
        String m_strPrimaryEmail;
        String m_strSecondaryEmail;
        String m_strPhoneNumber;
        String m_strLogo;
        Boolean m_bIsSoftLocked;
        string m_strSoftlockedByName;
        string m_strHardlockedByName;
        int m_nSoftLockedBy;
        DateTime? m_dtSoftLockTimestamp;
        Boolean m_bIsHardLocked;
        int m_nHardLockedBy;
        DateTime? m_dtHardLockTimestamp;
        DateTime? m_dtCreateTimestamp;
        int m_nCreatedBy;
        string m_strCreatedByName;
        DateTime? m_dtModifiedTimestamp;
        int m_nModifiedBy;
        string m_strModifiedByName;
        Boolean m_bDeleteFlag;
        int m_nPageNumber;
        int m_nRowSize;
        String m_strSortOn;
        String m_strSortType;
        String m_strSearch;
        String m_strSearchOn;
        Boolean m_bCondition;
        String m_strOrganizationIds;

        /// <summary>
        /// Constructor of the class.
        /// </summary> 
        /// <date_created>4/14/2014</date_created>
        public COrganization()
        {
            m_nOrganizationId = 0;
            m_strOrganizationName = "";
            m_strAddress = "";
            m_strCity = "";
            m_strState = "";
            m_strZip = "";
            m_strWebSite = "";
            m_strPrimaryEmail = "";
            m_strSecondaryEmail = "";
            m_strPhoneNumber = "";
            m_strLogo = "";
            m_bIsSoftLocked = false;
            m_nSoftLockedBy = 0;
            m_dtSoftLockTimestamp = null;
            m_bIsHardLocked = false;
            m_nHardLockedBy = 0;
            m_dtHardLockTimestamp = null;
            m_dtCreateTimestamp = null;
            m_nCreatedBy = 0;
            m_strCreatedByName = "";
            m_dtModifiedTimestamp = null;
            m_nModifiedBy = 0;
            m_strModifiedByName = "";
            m_bDeleteFlag = false;
            m_nPageNumber = 0;
            m_nRowSize = 0;
            m_strSortOn = "";
            m_strSortType = "";
            m_strSearch = "";
            m_strSearchOn = "";
            m_bCondition = false;
            m_strOrganizationIds = "";
            m_strHardlockedByName = "";
            m_strSoftlockedByName = "";
        }

        /// <summary>
        /// Constructor of the class.
        /// </summary> 
        /// <date_created>4/14/2014</date_created>
        public COrganization(int nOrganizationId, String strOrganizationName, String strAddress, String strCity, String strState
            , String strZip, String strWebSite, String strPrimaryEmail, String strSecondaryEmail, String strPhoneNumber
            , String strLogo, Boolean bIsSoftLocked, int nSoftLockedBy
            , DateTime? dtSoftLockTimestamp, Boolean bIsHardLocked, int nHardLockedBy, DateTime? dtHardLockTimestamp, DateTime? dtCreateTimestamp
            , int nCreatedBy, DateTime? dtModifiedTimestamp, int nModifiedBy, Boolean bDeleteFlag, int nPageNumber
            , int nRowSize, String strSortOn, String strSortType, String strSearch, String strSearchOn, Boolean bCondition, String strOrganizationIds, string strCreatedByName, string strModifiedByName, string strSoftlockedByName, string strHardlockedByName)
        {
            m_nOrganizationId = nOrganizationId;
            m_strOrganizationName = strOrganizationName;
            m_strAddress = strAddress;
            m_strCity = strCity;
            m_strState = strState;
            m_strZip = strZip;
            m_strWebSite = strWebSite;
            m_strPrimaryEmail = strPrimaryEmail;
            m_strSecondaryEmail = strSecondaryEmail;
            m_strPhoneNumber = strPhoneNumber;
            m_strLogo = strLogo;
            m_bIsSoftLocked = bIsSoftLocked;
            m_nSoftLockedBy = nSoftLockedBy;
            m_dtSoftLockTimestamp = dtSoftLockTimestamp;
            m_bIsHardLocked = bIsHardLocked;
            m_nHardLockedBy = nHardLockedBy;
            m_dtHardLockTimestamp = dtHardLockTimestamp;
            m_dtCreateTimestamp = dtCreateTimestamp;
            m_nCreatedBy = nCreatedBy;
            m_strCreatedByName = strCreatedByName;
            m_strModifiedByName = strModifiedByName;
            m_dtModifiedTimestamp = dtModifiedTimestamp;
            m_nModifiedBy = nModifiedBy;
            m_bDeleteFlag = bDeleteFlag;
            m_nPageNumber = nPageNumber;
            m_nRowSize = nRowSize;
            m_strSortOn = strSortOn;
            m_strSortType = strSortType;
            m_strSearch = strSearch;
            m_strSearchOn = strSearchOn;
            m_bCondition = bCondition;
            m_strOrganizationIds = strOrganizationIds;
            m_strSoftlockedByName = strSoftlockedByName;
            m_strHardlockedByName = strHardlockedByName;
        }

        /// <summary>
        /// Used to store OrganizationId
        /// </summary>
        public int OrganizationId
        {
            get { return m_nOrganizationId; }
            set { m_nOrganizationId = value; }
        }
        /// <summary>
        /// Used to store OrganizationName
        /// </summary>
        // Validation to check whether field contains any entry or not
        [Required(ErrorMessage = "*OrganizationName is Required")]
        //validation to check the minimum and maximum string length 
        [StringLength(49, MinimumLength = 1, ErrorMessage = "maximum 49 characters")]
        // Validation to check whether field contains any special characters or not
        //[RegularExpression(@"^[0-9a-zA-Z\ ]+$", ErrorMessage = "No special characters allowed")]
        // Display name of this property
        [DisplayName("Organization")]
        public String OrganizationName
        {
            get { return m_strOrganizationName; }
            set { m_strOrganizationName = value; }
        }
        /// <summary>
        /// Used to store Address
        /// </summary>
        // Validation to check whether field contains any entry or not
        [Required(ErrorMessage = "*OrganizationAddress is Required")]
        //validation to check the minimum and maximum string length 
        [StringLength(250, MinimumLength = 1, ErrorMessage = "maximum 250 characters")]
        // Display name of this property
        [DisplayName("Address")]
        public String Address
        {
            get { return m_strAddress; }
            set { m_strAddress = value; }
        }
        /// <summary>
        /// Used to store City
        /// </summary>
        // Validation to check whether field contains any entry or not
        [Required(ErrorMessage = "*City is Required")]
        //validation to check the minimum and maximum string length 
        [StringLength(49, MinimumLength = 1, ErrorMessage = "maximum 49 characters")]
        public String City
        {
            get { return m_strCity; }
            set { m_strCity = value; }
        }
        /// <summary>
        /// Used to store State
        /// </summary>
        // Validation to check whether field contains any entry or not
        [Required(ErrorMessage = "*State is Required")]
        //validation to check the minimum and maximum string length 
        [StringLength(49, MinimumLength = 1, ErrorMessage = "maximum 49 characters")]
        // Display name of this property
        [DisplayName("State")]
        public String State
        {
            get { return m_strState; }
            set { m_strState = value; }
        }
        /// <summary>
        /// Used to store Zip
        /// </summary>
        // Validation to check whether field contains any entry or not
        [Required(ErrorMessage = "*ZipCode is Required")]
        // Validation to check whether field contains any other character than a number
        [RegularExpression(@"^[0-9]+$", ErrorMessage = "Zipcode not valid")]
        //validation to check the minimum and maximum string length 
        [StringLength(49, MinimumLength = 5, ErrorMessage = "maximum 15 characters")]
        // Display name of this property
        [DisplayName("Zip")]
        public String Zip
        {
            get { return m_strZip; }
            set { m_strZip = value; }
        }
        /// <summary>
        /// Used to store WebSite
        /// </summary>
        // Validation to check whether website is valid
        [RegularExpression(@"(ftp|http|https):\/\/(?!http:\/\/|https:\/\/|ftp:\/\/|:\/|:|\/\/)([a-z|A-Z]+)(\w+:{0,1}\w*@)?(\S+)(0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$",
                           ErrorMessage = "WebSite is not valid")]
        //validation to check the minimum and maximum string length 
        [StringLength(250, MinimumLength = 1, ErrorMessage = "maximum 250 characters")]
        // Display name of this property
        [DisplayName("Website")]
        public String WebSite
        {
            get { return m_strWebSite; }
            set { m_strWebSite = value; }
        }
        /// <summary>
        /// Used to store PrimaryEmail
        /// </summary>
        // Validation to check whether field contains any entry or not
        [Required(ErrorMessage = "*Primary Email is Required")]
        // Validation to check whether email is valid
        [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" +
                           @"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" +
                           @".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$",
                           ErrorMessage = "PrimaryEmail is not valid")]
        //validation to check the minimum and maximum string length 
        [StringLength(250, MinimumLength = 1, ErrorMessage = "maximum 250 characters")]
        // Display name of this property
        [DisplayName("Primary Email")]
        public String PrimaryEmail
        {
            get { return m_strPrimaryEmail; }
            set { m_strPrimaryEmail = value; }
        }
        /// <summary>
        /// Used to store SecondaryEmail
        /// </summary>
        // Validation to check whether email is valid
        [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" +
                           @"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" +
                           @".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$",
                           ErrorMessage = "SecondaryEmail is not valid")]
        //validation to check the minimum and maximum string length 
        [StringLength(250, MinimumLength = 1, ErrorMessage = "maximum 250 characters")]
        // Display name of this property
        [DisplayName("Secondary Email")]
        public String SecondaryEmail
        {
            get { return m_strSecondaryEmail; }
            set { m_strSecondaryEmail = value; }
        }
        /// <summary>
        /// Used to store PhoneNumber
        /// </summary>
        // Validation to check whether field contains any entry or not
        [Required(ErrorMessage = "*phone number is Required")]
        // Validation to check whether phone number is valid
        [RegularExpression(@"^((\+)?[1-9]{1,3})?(((\s)?[-](\s)?)|[.\s])?((\(\d{1,3}\))|\d{1,4})((((\s)?[-](\s)?)|[.\s])?[0-9]{1,12}){1,2}$",
                           ErrorMessage = "Phone number is not valid")]
        //validation to check the minimum and maximum string length 
        [StringLength(49, MinimumLength = 10, ErrorMessage = "maximum 49 characters")]
        // Display name of this property
        [DisplayName("Phone No.")]
        public String PhoneNumber
        {
            get { return m_strPhoneNumber; }
            set { m_strPhoneNumber = value; }
        }
        /// <summary>
        /// Used to store Logo
        /// </summary>
        // Validation to check whether field contains any entry or not
        [Required(ErrorMessage = "*Logo is Required")]
        //validation to check the minimum and maximum string length 
        [StringLength(250, MinimumLength = 1, ErrorMessage = "maximum 250 characters")]
        public String Logo
        {
            get { return m_strLogo; }
            set { m_strLogo = value; }
        }

        /// <summary>
        /// Used to store IsSoftLocked
        /// </summary>
        public Boolean IsSoftLocked
        {
            get { return m_bIsSoftLocked; }
            set { m_bIsSoftLocked = value; }
        }
        /// <summary>
        /// Used to store SoftLockedBy
        /// </summary>
        public int SoftLockedBy
        {
            get { return m_nSoftLockedBy; }
            set { m_nSoftLockedBy = value; }
        }
        /// <summary>
        /// Used to store SoftLockTimestamp
        /// </summary>
        public DateTime? SoftLockTimestamp
        {
            get { return m_dtSoftLockTimestamp; }
            set { m_dtSoftLockTimestamp = value; }
        }
        /// <summary>
        /// Used to store IsHardLocked
        /// </summary>
        public Boolean IsHardLocked
        {
            get { return m_bIsHardLocked; }
            set { m_bIsHardLocked = value; }
        }
        /// <summary>
        /// Used to store username who owns the softlock.
        /// </summary>
        // Display name of this property
        [DisplayName("Viewed By")]
        public string SoftLockedByName
        {
            get { return m_strSoftlockedByName; }
            set { m_strSoftlockedByName = value; }
        }
        /// <summary>
        /// Used to store username who owns the hardlock.
        /// </summary>
        // Display name of this property
        [DisplayName("Locked By")]
        public string HardLockedByName
        {
            get { return m_strHardlockedByName; }
            set { m_strHardlockedByName = value; }
        }
        /// <summary>
        /// Used to store HardLockedBy
        /// </summary>
        public int HardLockedBy
        {
            get { return m_nHardLockedBy; }
            set { m_nHardLockedBy = value; }
        }
        /// <summary>
        /// Used to store HardLockTimestamp
        /// </summary>
        public DateTime? HardLockTimestamp
        {
            get { return m_dtHardLockTimestamp; }
            set { m_dtHardLockTimestamp = value; }
        }
        /// <summary>
        /// Used to store CreateTimestamp
        /// </summary>
        // Display name of this property
        [DisplayName("Created On")]
        public DateTime? CreateTimestamp
        {
            get { return m_dtCreateTimestamp; }
            set { m_dtCreateTimestamp = value; }
        }
        /// <summary>
        /// Used to store CreatedBy
        /// </summary>
        public int CreatedBy
        {
            get { return m_nCreatedBy; }
            set { m_nCreatedBy = value; }
        }
        /// <summary>
        /// Used to store CreatedBy Name
        /// </summary>
        // Display name of this property
        [DisplayName("Created By")]
        public string CreatedByName
        {

            get { return m_strCreatedByName; }
            set { m_strCreatedByName = value; }
        }
        /// <summary>
        /// Used to store ModifiedBy Name
        /// </summary>
        // Display name of this property
        [DisplayName("Modified By")]
        public string ModifiedByName
        {

            get { return m_strModifiedByName; }
            set { m_strModifiedByName = value; }
        }
        /// <summary>
        /// Used to store ModifiedTimestamp
        /// </summary>
        // Display name of this property
        [DisplayName("Modified On")]
        public DateTime? ModifiedTimestamp
        {
            get { return m_dtModifiedTimestamp; }
            set { m_dtModifiedTimestamp = value; }
        }
        /// <summary>
        /// Used to store ModifiedBy
        /// </summary>
        public int ModifiedBy
        {
            get { return m_nModifiedBy; }
            set { m_nModifiedBy = value; }
        }
        /// <summary>
        /// Used to store DeleteFlag
        /// </summary>
        public Boolean DeleteFlag
        {
            get { return m_bDeleteFlag; }
            set { m_bDeleteFlag = value; }
        }
        /// <summary>
        /// Used to store PageNumber
        /// </summary>
        public int PageNumber
        {
            get { return m_nPageNumber; }
            set { m_nPageNumber = value; }
        }
        /// <summary>
        /// Used to store RowSize
        /// </summary>
        public int RowSize
        {
            get { return m_nRowSize; }
            set { m_nRowSize = value; }
        }
        /// <summary>
        /// Used to store SortOn
        /// </summary>
        public String SortOn
        {
            get { return m_strSortOn; }
            set { m_strSortOn = value; }
        }
        /// <summary>
        /// Used to store SortType
        /// </summary>
        public String SortType
        {
            get { return m_strSortType; }
            set { m_strSortType = value; }
        }
        /// <summary>
        /// Used to store Condition
        /// </summary>
        public Boolean Condition
        {
            get { return m_bCondition; }
            set { m_bCondition = value; }
        }
        /// <summary>
        /// Used to store OrganizationIds
        /// </summary>
        public String OrganizationIds
        {
            get { return m_strOrganizationIds; }
            set { m_strOrganizationIds = value; }
        }

        /// <summary>
        /// Used to store Search
        /// </summary>
        public String Search
        {
            get { return m_strSearch; }
            set { m_strSearch = value; }
        }

        /// <summary>
        /// Used to store SearchOn
        /// </summary>
        public String SearchOn
        {
            get { return m_strSearchOn; }
            set { m_strSearchOn = value; }
        }
    }
}